home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Graphics Programming (2nd Edition)
/
Visual Basic Graphics Programming 2nd Edition.iso
/
OldSrc
/
CH1
/
SRC
/
MIRROR.FRM
< prev
next >
Wrap
Text File
|
1996-05-02
|
6KB
|
221 lines
VERSION 4.00
Begin VB.Form MirrorForm
AutoRedraw = -1 'True
Caption = "Mirror"
ClientHeight = 5205
ClientLeft = 3705
ClientTop = 735
ClientWidth = 2115
Height = 5895
Left = 3645
LinkTopic = "Form1"
ScaleHeight = 5205
ScaleWidth = 2115
Top = 105
Width = 2235
Begin VB.PictureBox PSetDest
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 1080
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 11
Top = 240
Width = 1020
End
Begin VB.PictureBox PaintDest
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 1080
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 10
Top = 3840
Width = 1020
End
Begin VB.PictureBox RefreshDest
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 1080
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 9
Top = 2040
Width = 1020
End
Begin VB.PictureBox RefreshSource
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 0
Picture = "MIRROR.frx":0000
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 6
Top = 2040
Width = 1020
End
Begin VB.PictureBox PaintSource
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 0
Picture = "MIRROR.frx":0882
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 1
Top = 3840
Width = 1020
End
Begin VB.PictureBox PSetSource
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 1020
Left = 0
Picture = "MIRROR.frx":1104
ScaleHeight = 64
ScaleMode = 3 'Pixel
ScaleWidth = 64
TabIndex = 0
Top = 240
Width = 1020
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Point/PSet W/refresh"
Height = 255
Index = 2
Left = 0
TabIndex = 8
Top = 1800
Width = 2100
End
Begin VB.Label RefreshLabel
BorderStyle = 1 'Fixed Single
Height = 255
Left = 0
TabIndex = 7
Top = 3120
Width = 2100
End
Begin VB.Label PaintLabel
BorderStyle = 1 'Fixed Single
Height = 255
Left = 0
TabIndex = 5
Top = 4920
Width = 2100
End
Begin VB.Label PSetLabel
BorderStyle = 1 'Fixed Single
Height = 255
Left = 0
TabIndex = 4
Top = 1320
Width = 2100
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "PaintPicture"
Height = 255
Index = 1
Left = 0
TabIndex = 3
Top = 3600
Width = 2100
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Point/PSet"
Height = 255
Index = 0
Left = 0
TabIndex = 2
Top = 0
Width = 2100
End
Begin VB.Menu mnuFile
Caption = "&File"
Begin VB.Menu mnuFileExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "MirrorForm"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
' ***********************************************
' Mirror the left halves of PSetSource and
' PaintSource onto their right halves.
' ***********************************************
Private Sub Form_Load()
Dim x As Single
Dim y As Single
Dim wid As Single
Dim hgt As Single
Dim start_time As Single
Dim stop_time As Single
Me.Show
MousePointer = vbHourglass
Refresh
' Mirror using PSet/Paint.
start_time = Timer
wid = PSetSource.ScaleWidth
For x = 0 To wid
For y = 0 To PSetSource.ScaleHeight
PSetDest.PSet (wid - x, y), PSetSource.Point(x, y)
Next y
Next x
stop_time = Timer
PSetLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
Refresh
' Mirror using PSet/Paint with refresh.
start_time = Timer
wid = RefreshSource.ScaleWidth
For x = 0 To wid
For y = 0 To RefreshSource.ScaleHeight
RefreshDest.PSet (wid - x, y), RefreshSource.Point(x, y)
Next y
RefreshDest.Refresh
Next x
stop_time = Timer
RefreshLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
Refresh
' Mirror using PaintPicture.
start_time = Timer
wid = PaintSource.ScaleWidth
hgt = PaintSource.ScaleHeight
PaintDest.PaintPicture PaintSource.Picture, _
0, 0, wid, hgt, _
wid - 1, 0, -wid, hgt, vbSrcCopy
stop_time = Timer
PaintLabel.Caption = Format$(stop_time - start_time, "0.000") & " sec"
MousePointer = vbDefault
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub mnuFileExit_Click()
Unload Me
End Sub